#!/bin/bash
#
# This file is part of SerialPundit.
# 
# Copyright (C) 2014-2018, Rishi Gupta. All rights reserved.
#
# The SerialPundit is DUAL LICENSED. It is made available under the terms of the GNU Affero 
# General Public License (AGPL) v3.0 for non-commercial use and under the terms of a commercial 
# license for commercial use of this software. 
#
# The SerialPundit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#################################################################################################

# Allow only one instance of this application to preserve state
APP_NAME=$(ps -ax | grep -v grep |grep sp-tty2com-app.jar)

if [ "x$APP_NAME" != "x" ]; then
	echo "The tty2com application can't have two instances. Exiting !"
	exit -1
fi

# Launch the application
java -splash:/usr/share/tty2com/splash.png -cp .:/usr/share/tty2com/sp-core.jar:/usr/share/tty2com/sp-tty.jar:/usr/share/tty2com/sp-tty2com-app.jar tty2comApp.TTY2COMApp

exit 0

